package org.lgiavedoni.android.franq.core.prediction.imp;

import java.util.Date;

import lombok.Data;

import org.lgiavedoni.android.franq.core.calendar.CalendarEvent;
import org.lgiavedoni.android.franq.core.calendar.CalendarEventImp;
import org.lgiavedoni.android.franq.core.calendar.RegisterCalendarEvent;
import org.lgiavedoni.android.franq.core.prediction.PredictableEvent;
import org.lgiavedoni.android.franq.core.prediction.Prediction;
import org.lgiavedoni.android.franq.core.sync.Synchronizable;
import org.lgiavedoni.android.franq.util.date.DateUtil;

@Data
public class PredictionEventDate extends Prediction implements RegisterCalendarEvent, Synchronizable {
	private boolean syncronized = false;
	private final PredictableEvent event;
	private final Date predictedDate;

	public PredictionEventDate(PredictableEvent event, Date predictedDate) {
		super();
		this.event = event;
		this.predictedDate = predictedDate;
	}

	public String getPredictedDateFormated() {
		return DateUtil.parseDateTime(predictedDate);
	}

	@Override
	public boolean checkOccurrence() {
		return event.checkOccurrence();
	}

	@Override
	public CalendarEvent toCalendarEvent() {
		return new CalendarEventImp(event.toString(), event.toString(), predictedDate);
	}
	
	@Override
	public void setSyncronized(boolean value) {
		this.syncronized=value;	
	}
}
